<?php

Raise::load('core.RaiseSingleton');

/**
 * TestCoreRaiseSingleton class
 * Testing unit of 'phpraise/core/RaiseSingleton.php'
 *
 * @author Sam-Mauris Yong <hellclanner at live dot com>
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreRaiseSingleton extends RaiseTest {

    public static function testClass(){
        self::assertClassExists('RaiseSingleton');
        self::assertClassExists('MockRaiseSingleton');
        self::assertClassExtends('MockRaiseSingleton', 'RaiseSingleton');
        self::assertClassExtends('RaiseSingleton', 'RaiseObject');

        self::assertClassMethod('RaiseSingleton', 'getInstance');
        self::assertClassMethod('MockRaiseSingleton', 'getInstance');
        
        $controlInstance = MockRaiseSingleton::getInstance();
        self::assertStrictEqual($controlInstance, MockRaiseSingleton::getInstance());
        $controlInstance->testValue = 10;
        self::assertStrictEqual($controlInstance->testValue, MockRaiseSingleton::getInstance()->testValue);
        self::assertStrictEqual($controlInstance->testValue, 10);

        $controlInstance->setValue(200);
        self::assertStrictEqual($controlInstance->testValue2, MockRaiseSingleton::getInstance()->testValue2);
        self::assertStrictEqual($controlInstance->testValue2, 200);
    }
    
}